package com.sde.mapper;

import com.sde.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Select("select * from user where username = #{userName}")
    User selectUserByName(String userName);


    void insertUser(User newUser);

    @Select("select * from user where id = #{userId}")
    User selectUserById(Integer userId);


    void update(User user);

    @Update("update user set user_pic = #{avatarUrl},update_time = now() where id = #{userId}")
    void updateAvator(@Param("avatarUrl") String avatarUrl,@Param("userId") Integer userId);

    @Select("select * from user where password = #{oldPwd}")
    User selectUserByPwd(String oldPwd);
}
